InBox DynamicFieldSelectDB
Version 6.3.14
Date of criation 02/07/2019
Resources
Create SelectDB dynamic field
This module makes it possible to create dynamic fields of the SelectDB type, which allows a connection to several databases.
Prerequisites
Framework
The following versions of the Znuny framework are supported:
- 6.x.x
Modules
The following modules are required:
- InBox Core 6.22.7 or superior
Operational system
The following operating systems are required:
- ODBC connection module of the desired bank.
Third Party Software
The following third party software is required:
- [None]
Instalation
bin/otrs.Console.pl Admin::Package::Install /path/to/InBox\ DynamicFieldSelectDB-6.3.14.opm
Configuration
This module has no system settings, only the dynamic field configuration.
Use
Dynamic field creation
After installing the module it will be possible to create dynamic fields of the SelectDB type, for that it is enough to go to Administration->Dynamic Fields and choose the SelectDB field, as in the image below:
When selecting the type of field to be added, it will present the field configuration screen:
In general configurations, it should be defined:
- Field name (this name must be unique).
- Field display name (text displayed to the user).
- Field order (optional).
- Shelf life.
Field Settings
In the field settings, the following must be defined:
- Minimum query size (minimum size to start the query).
- Maximum consultation result (number of results in consultation).
- Standard Connection (If using the standard connection, it will connect to the local database, for remote database cases, select 'No' and the fields for configuration will be displayed)
- Bank DSN (Specify the DSN for the database used. Example: DBI: mysql: database = otrs; host = localhost).
- Bank user.
- Bank password (optional).
- Bank type (mssql, mysql, oracle and postgresql).
- Bank table (table where the query will be made).
- Identification key (unique query identifier).
- Table columns (columns that will be returned in the query).
- Search by (field of the table that will be used in the search).
- SELECT AND search (table column and dynamic field to perform an AND search).
- Cache stay time.
- Possible Cache Values.
- Maximum quantity (maximum number of entries available).
- Default value (optional).
You will need to add "Table columns" for the field to work correctly by mapping the table columns.
You will only need to add the key.
This value can be the same identification key if you don't have one.
If you want to use the functionality of adding column values in dynamic fields, the settings are not necessary.
The important thing is to have at least one key (column) configured in the Table columns option.
O campo irá realizar a consulta ao banco configurado com a condição ... WHERE = DatabaseFieldSearch. É possível adicionar uma outra condição AND no campo abaixo. Basta informar o nome da tabela e o campo dinâmico que irá conter o valor.
OBS: O campo dinâmico configurado deverá aparecer na mesma tela em que o campo SelectDB estiver.
Caso seja necessário adicionar um trecho SQL, basta usar o campo abaixo. O trecho SQL será adicionado após o WHERE e antes do ORDER BY. Para utilizar valores de campo dinâmico em tela, adicione a TAG <DynamicField_name> no campo
Exemplo:
Use of the field
With the field, configured on the desired screens. The field is a text box, which allows the user to search for terms, already pre-established, in the field configuration step. So the user can search for what he wants, and he will display what was found according to the search performed:
If the mapping of select values in other dynamic fields is configured, when selecting a value, it will automatically set value to the configured fields.
If the AND search is configured, the field will bring values based on another dynamic field already filled in.
Generic Agent Save DF in backgroud
This generic attendant allows you to save the value in dynamic fields, based on a SelecDB type field. To do this, you need to have the SelectDB field configured, and set it to save the column values in dynamic fields. The generic attendant will fetch information from the caller, customer user or company and save it in these dynamic fields defined in the backgroud.
Run
Custom module:
Module => Kernel::System::GenericAgent::SelectDBAssociation::SaveDFByCustomerUser First Param Key => SelectDBField First Param Value => Define which Select DB type field will be used to query the values. Second Param Key => AtributeSearchObject Second Param Value => Defines the type of data that will be used to search in the SelecDB field, the types Ticket, CustomerUser and Customer are accepted. Third Param Key => AtributeSearchField Third Param Value => Define which attribute of the object will be used to search.